package io.fivefire.base.common.enums;

import java.util.List;

/**
 * @Author: Sjy
 * @Date: 2018/5/30 下午10:14
 */
public enum DataStatusEnum implements IndexedEnum {
    ENABLE(1, "可用"),

    DISABLE(0, "不可用"),
    FORBIDDEN(3,"禁用");
    private int code;
    private String desc;

    DataStatusEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }
    private static final List<DataStatusEnum> INDEXES = IndexedEnumUtil.toIndexes(DataStatusEnum.values());

    @Override
    public int getCode() {
        return code;
    }

    @Override
    public String getName() {
        return desc;
    }

    public String getDesc() {
        return desc;
    }
    public static DataStatusEnum codeOf(final int code) {
        return IndexedEnumUtil.valueOf(INDEXES, code);
    }
}
